feat: build host-only doc tools in host config via aspect_bazel_lib platform_transition_binary#635
Draft
umaucher wants to merge 1 commit into
Draft
Conversation
The runnable documentation targets (docs, docs_combo, docs_check, docs_link_check, live_preview, live_preview_combo_experimental, ide_support) are host tools that run Python/Sphinx locally. Under a cross `--platforms` (e.g. QNX) they were configured for the target platform and failed Python toolchain resolution, breaking `bazel build //...` in cross-compiling consumers. Wrap each with `platform_transition_binary` from aspect_bazel_lib, which transitions the wrapped binary to a fixed `target_platform` (`@local_config_platform//:host`) and forwards its executable, runfiles and RunEnvironmentInfo, so `bazel run //:docs` keeps working. `sphinx_build` is only consumed as a tool (already built in the exec/host config) and is tagged `manual` so wildcard builds under a cross platform do not try to configure it for the target platform. aspect_bazel_lib is already in the module graph via aspect_rules_py; it is declared as a direct dep so the rule can be loaded.
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The runnable documentation targets created by
docs()—docs,docs_combo,docs_check,docs_link_check,live_preview,live_preview_combo_experimental,ide_support— are host tools that run Python/Sphinx on the build machine. When a consumer builds with a cross--platforms(e.g.--config=per-x86_64-qnx -- //...), these top-level targets get configured for the target platform and fail Python toolchain resolution (No matching toolchains ... tools/python), breaking the whole build in cross-compiling consumers (persistency, reference_integration).What
Each host-only run target is wrapped with
platform_transition_binaryfromaspect_bazel_lib, transitioning the wrapped binary to a fixedtarget_platform(@local_config_platform//:host) and forwarding its executable, runfiles andRunEnvironmentInfo, sobazel run //:docskeeps working unchanged.aspect_bazel_libis already in the module graph viaaspect_rules_py; it is declared as a directbazel_dep(2.16.0) so the rule can be loaded.sphinx_buildis only ever consumed as a tool (already built in the exec/host config), so it needs no transition; it is taggedmanualso a wildcardbazel build //...under a cross platform skips it.Comparison with #633
_host_binary)platform_transition_binary)--host_platformdynamically@local_config_platform//:host(autodetected host)bazel_deponaspect_bazel_lib(already transitive)The dynamic
--host_platformbehaviour of #633 is more precise when a consumer sets a specific--host_platformthat differs from the autodetected host; this PR trades that for less code and a battle-tested rule.Validation
bazel build //:docs //:ide_support //:needs_json //:metrics_json— no regression;cqueryconfirmsRunEnvironmentInfois forwarded and the binary transitions to@local_config_platform//:host.bazel build --config=per-x86_64-qnx -- //...no longer fails Python toolchain resolution (0 toolchain errors; only the unrelatedvalid_fromskew fixed by Set valid_from attribute for all features score#3064).buildifierclean.